package com.ihr360.payroll.model.dto.salary.report.embedded;

import com.ihr360.commons.model.type.FieldSource;
import com.ihr360.commons.model.type.FormulaFrom;
import com.ihr360.commons.model.type.RoundingMode;
import com.ihr360.commons.model.type.SalaryFieldValueType;
import com.ihr360.payroll.model.base.salaryreport.ISalaryField;

import java.io.Serializable;

/**
 * Created by Eric on 2018/4/17/017.
 */
public class SalaryFieldSnapshot implements Serializable,ISalaryField {
    /** 代码
     * 对于从系统中选择的字段代码应该和meta中的code相同，如果是用户自己添加的，code和name一致
     */
    private String code;

    private String name;

    /** 序号 */
    private int indexno = 1;

    /** 舍入规则 */
    protected RoundingMode roundingMode = RoundingMode.ROUND;

    /** 字段取值方式 */
    protected FieldSource source;

    /** 薪酬字段值类型 */
    protected SalaryFieldValueType valueType = SalaryFieldValueType.NUMBER;

    /**
     * 是否是合并计税项目,只有系统能控制
     * @return
     */
    private boolean taxMergeField;

    /**
     * 数值类型时为精确位数
     */
    protected int pattern = 0;

    /**
     * Raw公式定义
     */
    protected String formula;

    /**
     * 公式来源
     */
    protected FormulaFrom formulaFrom;

    /**
     * 分段计薪公式配置
     * 系统目前只支持一个薪资周期内分两段
     */
    protected String phasedFormula;

    /**
     * 合并计税
     */
    protected String mergeTaxFormula;

    public SalaryFieldValueType getValueType() {
        return valueType;
    }

    public void setValueType(SalaryFieldValueType valueType) {
        this.valueType = valueType;
    }

    public FieldSource getSource() {
        return source;
    }

    public void setSource(FieldSource source) {
        this.source = source;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getIndexno() {
        return indexno;
    }

    public void setIndexno(int indexno) {
        this.indexno = indexno;
    }

    public RoundingMode getRoundingMode() {
        return roundingMode;
    }

    public void setRoundingMode(RoundingMode roundingMode) {
        this.roundingMode = roundingMode;
    }

    public int getPattern() {
        return pattern;
    }

    public void setPattern(int pattern) {
        this.pattern = pattern;
    }

    public String getFormula() {
        return formula;
    }

    public void setFormula(String formula) {
        this.formula = formula;
    }

    public FormulaFrom getFormulaFrom() {
        return formulaFrom;
    }

    public void setFormulaFrom(FormulaFrom formulaFrom) {
        this.formulaFrom = formulaFrom;
    }

    public String getPhasedFormula() {
        return phasedFormula;
    }

    public void setPhasedFormula(String phasedFormula) {
        this.phasedFormula = phasedFormula;
    }

    public boolean isTaxMergeField() {
        return taxMergeField;
    }

    public void setTaxMergeField(boolean taxMergeField) {
        this.taxMergeField = taxMergeField;
    }

    @Override
    public String getMergeTaxFormula() {
        return mergeTaxFormula;
    }

    public void setMergeTaxFormula(String mergeTaxFormula) {
        this.mergeTaxFormula = mergeTaxFormula;
    }
}
